//
// Copyright (c) 2024 BPer
//

#ifndef INCLUDE_BPERAVUTIL_VIDEO_BPERCMETA_H_
#define INCLUDE_BPERAVUTIL_VIDEO_BPERCMETA_H_

#include <stdint.h>

#include <bperutil/BPerAvType.h>
void bPer_find_start_code(BPerVideoCodec pve,uint8_t *buf,int32_t bufLen,int32_t *vpsPos,int32_t *vpsLen,int32_t *spsPos,int32_t *spsLen,int32_t *ppsPos,int32_t *ppsLen);
int32_t bPer_find_pre_start_code(uint8_t *buf,int32_t bufLen);
void bPer_createH264Meta( BPerVideoMeta* pvmd, BPerFrame *videoFrame);
void bPer_createH265Meta( BPerVideoMeta* pvmd, BPerFrame *videoFrame);
void bPer_getConfig_Flv_H264( BPerH2645Conf *p_264, uint8_t *configBuf,int32_t *p_configLen);
void bPer_getConfig_Meta_H264( BPerSample* sps,  BPerSample* pps,uint8_t *configBuf,int32_t *p_configLen);
void bPer_getConfig_Flv_H265( BPerH2645Conf *p_264, uint8_t *configBuf,int32_t *p_configLen);
void bPer_getConfig_Meta_H265( BPerSample* vps, BPerSample* sps,  BPerSample* pps, uint8_t *configBuf,int32_t *p_configLen);

void bPer_getH265RtmpHeader(uint8_t *meta, uint8_t *src, int32_t *hLen);
void bPer_getH264RtmpHeader(uint8_t *buf, uint8_t *src, int32_t *hLen);

void bPer_decodeMetaH264(uint8_t *configBuf,int32_t p_configLen, BPerSample* sps, BPerSample* pps);
void bPer_decodeMetaH265(uint8_t *configBuf,int32_t p_configLen, BPerSample* vps, BPerSample* sps, BPerSample* pps);




#endif /* INCLUDE_BPERAVUTIL_VIDEO_BPERCMETA_H_ */
